package com.bigdata.security.shiro.session.redis;

import org.apache.shiro.session.Session;
import org.apache.shiro.session.mgt.SessionContext;
import org.apache.shiro.session.mgt.SessionFactory;

/**
 * @ClassNameRedisSessionFactory
 * @Description
 * @Author lly
 * @Date2019/12/12 14:55
 * @Version V1.0
 **/
public class RedisSessionFactory implements SessionFactory {

    @Override
    public Session createSession(SessionContext initData) {
        if (initData != null) {
            String host = initData.getHost();
            if (host != null) {
                return new RedisSession(host);
            }
        }
        return new RedisSession();
    }
}
